package com.boot.security.server.dao.level;

import java.util.List;
import java.util.Map;

import com.boot.security.server.model.level.TswUserLevel;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Options;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;



@Mapper
public interface TswUserLevelDao {

    @Select("select * from tsw_user_level t where t.id = #{id}")
    TswUserLevel getById(Long id);

    @Delete("delete from tsw_user_level where id = #{id}")
    int delete(Long id);

    int update(TswUserLevel tswUserLevel);
    
    @Options(useGeneratedKeys = true, keyProperty = "id")
    @Insert("insert into tsw_user_level(user_id, level_id, create_time, state, update_time, user_level_note, user_level_remark) values(#{userId}, #{levelId}, #{createTime}, #{state}, #{updateTime}, #{userLevelNote}, #{userLevelRemark})")
    int save(TswUserLevel tswUserLevel);
    
    int count(@Param("params") Map<String, Object> params);

    List<TswUserLevel> list(@Param("params") Map<String, Object> params, @Param("offset") Integer offset, @Param("limit") Integer limit);
}
